/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package seso;

import java.awt.Graphics;
import java.awt.Image;

/**
 *
 * @author Administrator
 */
public class RDialogShortcutExpandSwitch extends javax.swing.JLabel {
    private Image expandImage = Util.getUserImage("resources/DlgShortcutExpandIcon.png");
    private Image collapseImage = Util.getUserImage("resources/DlgShortcutCollapseIcon.png");
    
    public int drawWidth = 8;
    public int drawHeight = 145;
    private boolean showExpandImage = false;
    
    public RDialogShortcutExpandSwitch() {
        super();
        setSize(drawWidth, drawHeight);
        setPreferredSize(new java.awt.Dimension(drawWidth, drawHeight));
        setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                showExpandImage = !showExpandImage;
                repaint();
            }
        });        
    }

    @Override
    protected void paintComponent(Graphics g) {
        setText("");
        g.drawImage((showExpandImage) ? expandImage : collapseImage, 0, 0, drawWidth, drawHeight, null);
        super.paintComponent(g);
    }

    /**
     * @return the showExpandImage
     */
    public boolean isShowExpandImage() {
        return showExpandImage;
    }

    /**
     * @param showExpandImage the showExpandImage to set
     */
    public void setShowExpandImage(boolean showExpandImage) {
        this.showExpandImage = showExpandImage;
    }
    
}
